using System.Configuration;

namespace Istace.Framework.Mapping.Core.Configuration
{
    /// <summary>
    /// 
    /// </summary>
    public class MappingAssemblyConfigInstanceCollection : ConfigurationElementCollection
    {

        /// <summary>
        /// Gets or sets a property, attribute, or child element of this configuration element.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns></returns>
        public MappingAssemblyConfigInstanceElement this[int index]
        {
            get
            {
                return BaseGet(index) as MappingAssemblyConfigInstanceElement;
            }
        }

        /// <summary>
        /// When overridden in a derived class, creates a new <see cref="T:System.Configuration.ConfigurationElement" />.
        /// </summary>
        /// <returns>
        /// A new <see cref="T:System.Configuration.ConfigurationElement" />.
        /// </returns>
        protected override ConfigurationElement CreateNewElement()
        {
            return new MappingAssemblyConfigInstanceElement();
        }

        /// <summary>
        /// Gets the element key for a specified configuration element when overridden in a derived class.
        /// </summary>
        /// <param name="element">The <see cref="T:System.Configuration.ConfigurationElement" /> to return the key for.</param>
        /// <returns>
        /// An <see cref="T:System.Object" /> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement" />.
        /// </returns>
        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((MappingAssemblyConfigInstanceElement)element).Assembly;
        }
    }
}